extends RigidBody2D

var direction: Vector2
var speed = 800

func _ready():
	gravity_scale = 0
	var playerPos = get_tree().get_first_node_in_group("player").global_position
	direction = (playerPos - global_position).normalized()

func _physics_process(delta):
	linear_velocity.x = direction.x * speed


func _on_timer_timeout():
	queue_free()
